package cn.fancy.sdk.pay.entity;

import org.json.JSONException;
import org.json.JSONObject;

import cn.fancy.sdk.entity.JsonParseInterface;

public class ChargeResult implements JsonParseInterface{
	public static final String _paymentId = "a";   
	public static final String _orderId = "b";   
	public static final String _statusCode = "c";   
	public static final String _resultCode = "d"; 
	public static final String _desc = "e"; 
	
    /**
     * 支付渠道id
     */
    private int paymentId;
    /**
     * 订单号
     */
    private String orderId;
    /**
     * 状态码  0 成功   -1 失
     */
    private String statusCode;
    /**
     * 支付渠道返回的结果
     */
    private String resultCode;
    /**
     *  支付渠道结果描述
     */    
    private String desc;
    
    
    
	public void setPaymentId(int paymentId) {
		this.paymentId = paymentId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	public void setResultCode(String resultCode) {
		this.resultCode = resultCode;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	@Override
	public JSONObject buildJson() {
		
		try 
		{
			JSONObject json = new JSONObject();
			json.put(_paymentId, paymentId);
			json.put(_orderId, orderId);
			json.put(_statusCode, statusCode);
			json.put(_resultCode, resultCode);
			json.put(_desc, desc);
			return json;
		} 
		catch (JSONException e) 
		{
			e.printStackTrace();
		}
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void parseJson(JSONObject json) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getShortName() {
		// TODO Auto-generated method stub
		return "ChargeResult";
	}
	
	@Override
	public String toString(){
		
		return "(paymentId="+paymentId+",orderId="+orderId+",statusCode="+statusCode+",resultCode="+resultCode+",desc="+desc+")";
	}

}
